#include "MrfsConferenceMessage.hpp"


inline Json::Value MrfsConferenceMessage::toJsonObject() const
{
    // NOT REQUIRED
    Json::Value json;
    return json;
} 

inline bool MrfsConferenceMessage::fromJsonObject(const Json::Value& object)
{
    if (object.isNull())
        return false;
    _origJson = object;

    _event = FastJsoncpp::GET_STR(object, "event");
    _id = FastJsoncpp::GET_STR(object, "_id");
    
    if (object.isMember("target") && object["target"].isObject()){
        const Json::Value& tmpTarget = object["target"];
        _target._memberId = FastJsoncpp::GET_STR(tmpTarget ,"memberId");
        _target._type = FastJsoncpp::GET_STR(tmpTarget, "type"); 
        _hasTarget = true;
    } else {
        _hasTarget = false;
    }
    return true;
}


const std::string& MrfsConferenceMessage::getConfResourceId() const
{
    return _id;
}
const std::string& MrfsConferenceMessage::getEvent() const
{
    return _event;
}
const std::string& MrfsConferenceMessage::getMemberId() const
{
    return _target._memberId;
}
const std::string& MrfsConferenceMessage::getType() const
{
    return _target._type;
}
const MrfsConferenceMessage::Target& MrfsConferenceMessage::getTarget() const
{
    return _target;
}
const Json::Value& MrfsConferenceMessage::getOrigRequestData() const
{
    return _origJson;
}